//
//  GymOverviewView.m
//  YunDongAdmin
//
//  Created by lqq on 2018/9/14.
//  Copyright © 2018年 cloudfighting.com. All rights reserved.
//

#import "GymOverviewView.h"
#import "StatisticsMemberViewController.h"

@interface GymOverviewView ()
@property (strong, nonatomic) IBOutletCollection(UIView) NSArray *gaiKuangItemBackViews;
@property (weak, nonatomic) IBOutlet UILabel *todayMemberTrainLabel;
@property (weak, nonatomic) IBOutlet UILabel *todayAddMemberLabel;
@property (weak, nonatomic) IBOutlet UILabel *planLabel;

@property (nonatomic, assign) BOOL isCheckAll;//
@end


@implementation GymOverviewView


-(void)awakeFromNib
{
    [super awakeFromNib];
    for (UIView *view in _gaiKuangItemBackViews) {
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(todayOverviewViewClicked:)];
        [view addGestureRecognizer:tap];
        view.layer.cornerRadius = 1;
        view.layer.masksToBounds = YES;
        view.layer.borderWidth = 1;
        view.layer.borderColor = HEXColor(@"F4F6F9").CGColor;
    }
}
- (void)refreshUIWithGymOverview:(M_GymOverview *)gymOverview isCheckAll:(BOOL)isCheckAll
{
    _isCheckAll = isCheckAll;
    self.planLabel.text = [NSString stringWithFormat:@"%ld",(long)gymOverview.planCount];
    self.todayMemberTrainLabel.text = [NSString stringWithFormat:@"%ld",(long)gymOverview.recordCount];
    self.todayAddMemberLabel.text = [NSString stringWithFormat:@"%ld",(long)gymOverview.memberCount];
}


/**
 今日概况
 */
- (void)todayOverviewViewClicked:(UITapGestureRecognizer *)tap
{
    NSInteger tag = tap.view.tag;
    StatisticsMemberType type = StatisticsMemberType_TodayPlan;
    switch (tag) {
        case 100:
        {
            type = StatisticsMemberType_TodayPlan;
        }
            break;
        case 101:
        {
            type = StatisticsMemberType_TodayRecord;
        }
            break;
        case 102:
        {
            type = StatisticsMemberType_TodayAddMember;
        }
            break;
            
        default:
            break;
    }
    
    StatisticsMemberViewController *vc = [StatisticsMemberViewController controllerWithStatisticsMemberType:type isCheckAll:_isCheckAll];
    [[self getCurrentViewController].navigationController pushViewController:vc animated:YES];
}

@end
